<!doctype html>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>
<body class="op-cover">
<script src="js/libs/base64.js"></script>
<script src="js/libs/jq.mobi.js"></script>
<script src="js/script.js"></script>
<script type="text/javascript">
$.ajaxSetup({ cache: false });

function callback() 
{
	//console.log("callback.html callback");

    
	var url = base_url() 
	+ 'index.php?c=api&a=user_unread&fr=android_push&nid='
	+ kget('last_nid')
	+'&token='
	+ kget('op_token');

	var data =  $.ajax({url:url, async:false}).responseText;
	var data_obj = $.parseJSON( data );

	if( data_obj.err_code == 0 )
	{
		if( parseInt(data_obj.data.notice) > 0 )
		{
			var last_nid = 0;

			if( isNaN( parseInt(kget('last_nid') ) )) 
				kset('last_nid' , 0 ) ;

			last_nid = parseInt(kget('last_nid'));


			if(  (parseInt(last_nid) == 0) || (parseInt(last_nid) < parseInt( data_obj.data.nid )) )
			{
				//sina.utils.keyguard("disable");
        		sina.utils.screen("wakeup");

        		sina.notification.notify
        		({
          			"saeAppName": "tt4s",
          			"redirectUrl": "todo.html",
          			"tickerText": "TeamToy有新消息",
          			"contentTitle": 'TeamToy有'+data_obj.data.notice+'条新信息',
          			"contentText": data_obj.data.text,
          			"id": 8
        		});

        		kset('last_nid',parseInt( data_obj.data.nid ));
				

			}
		}
	}

}
</script>

</body>
</html>
